﻿define(['jquery', 'standardArtDialog'], function ($, artDialog) {
    var preview = function (ev) {
        $(ev).each(function () {
            $(this).mouseenter(function () {
                var self = $(this);
                var windowWidth = $(window).width();
                var widthStyle = 'max-width:700px;';
                artDialog.dialog({
                    title: false,
                    follow: self[0],
                    cancel: false,
                    content: '<img src="' + self.attr('hover-src') + '" style="' + widthStyle + '">'
                });
            }).mouseleave(function () {
                var list = art.dialog.list;
                for (var i in list) {
                    list[i].close();
                }
            });
        });
    }
    return preview;
})